package com.hx.oracle.reflact;

import com.hx.oracle.dao.CountriesDao;
import com.hx.oracle.dao.RegionsDao;
import com.hx.oracle.entity.Countries;
import com.hx.oracle.entity.Regions;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.List;

public class Denmo1 {
    public static void main(String[] args) {
        RegionsDao regionsDao=new RegionsDao();
        CountriesDao countriesDao=new CountriesDao();

        List<Regions> regions=regionsDao.findAll();
        for(Regions region:regions){
            System.out.println(region);
        }
       /* System.out.println("--------------");
        List<Countries>countries=countriesDao.findAll();
        for (Countries country:countries){
            System.out.println(country);
        }*/



       /* Regions regions1=new Regions(10,"昆明");
        regionsDao.insert(regions1);
*/
        Countries countries1=new Countries();
        countries1.setCountryId("KM");
        countries1.setCountryName("云南");
        countries1.setRegionId(10);
       countriesDao.upDateById(countries1);
       // regionsDao.deleteById("10");

      /*Regions x=new Regions();
      Class clazz=x.getClass();
        //Class <Regions> clazz=Regions.class;
        System.out.println(clazz.getName());
        System.out.println(clazz.getSimpleName());

        Field[] fields=clazz.getDeclaredFields();
        for(Field field:fields ){
            System.out.println(field.getName()+"\t"+field.getType().getName());
        }
        System.out.println("-----------------");
        Field[] fields1=clazz.getFields();
        for (Field field:fields1){
            System.out.println(field.getName());
        }

        System.out.println("=================");
        Method[] methods=clazz.getDeclaredMethods();
        for(Method method:methods){
            System.out.println(method.getName());
            Parameter[] parameters=method.getParameters();
            System.out.println("参数为：");
            for(Parameter parameter:parameters){
                System.out.println(parameter.getName()+"\t"+parameter.getType().getName());
            }
            System.out.println("类型为：");
            System.out.println(method.getReturnType().getName());

        }*/
    }
}
